package cn.chainco.cts.jdo;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Transient;

//数据字典
@Entity
@Table(name = "cts_im")
public class IM implements Serializable {

	private static final long serialVersionUID = 1L;

	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	private Long id;

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "senderId", nullable = false)
	private User sender; // 发件人

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "receiverId", nullable = false)
	private User receiver; // 收件人

	@Column
	private Long workId; // 关联的ID

	@Column(length = 512)
	private String msgContent; // 消息内容

	@Temporal(TemporalType.TIMESTAMP)
	private Date sendDate; // 发送时间

	@Column(nullable = false)
	private Integer isRead = 0; // 0.未读 1.已读

	@Column(length = 100)
	private String deleterId; // 记录删除聊天记录人的ID

	@Transient
	private String sheetUrl; // 保存关于单路径的临时变量

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public Integer getIsRead() {
		return isRead;
	}

	public void setIsRead(Integer isRead) {
		this.isRead = isRead;
	}

	public String getMsgContent() {
		return msgContent;
	}

	public void setMsgContent(String msgContent) {
		this.msgContent = msgContent;
	}

	public Date getSendDate() {
		return sendDate;
	}

	public void setSendDate(Date sendDate) {
		this.sendDate = sendDate;
	}

	public String getSheetUrl() {
		return sheetUrl;
	}

	public void setSheetUrl(String sheetUrl) {
		this.sheetUrl = sheetUrl;
	}

	public String getDeleterId() {
		return deleterId;
	}

	public void setDeleterId(String deleterId) {
		this.deleterId = deleterId;
	}

	public User getSender() {
		return sender;
	}

	public void setSender(User sender) {
		this.sender = sender;
	}

	public User getReceiver() {
		return receiver;
	}

	public void setReceiver(User receiver) {
		this.receiver = receiver;
	}

	public Long getWorkId() {
		return workId;
	}

	public void setWorkId(Long workId) {
		this.workId = workId;
	}

}
